package com.springboot.jdk.colleciton;

import java.util.Iterator;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * LinkedBlockingQueue Demo
 *
 * @author: zr
 * @date: 2021-10-12
 */
public class LinkedBlockingQueueDemo {

    public static void main(String[] args) throws InterruptedException {
        LinkedBlockingQueue<String> linkedBlockingQueue = new LinkedBlockingQueue();
        linkedBlockingQueue.put("张三");
        System.out.println(linkedBlockingQueue.take());

        Iterator<String> iterator = linkedBlockingQueue.iterator();
        if (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

    }
}
